<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.sql.Statement"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.Connection"%>
<%@ page import="java.sql.DriverManager"%>
<HTML><HEAD><TITLE>灵通邮件统计页面</TITLE>

<LINK href="Default.files/css.css" type=text/css rel=stylesheet>

<SCRIPT src="fPopUpCalendarDlg.js"></SCRIPT>

<SCRIPT language=javascript>
function check(){
<% 
String section="0";
 section=(String)session.getAttribute("mger_type");
if(section.equals("0")){%>
	if(option.areacode.value=="")
	{
	alert("你选择您要统计的分公司");
	}
	
	else <%}%>if((option.begintime.value==""))
	{
	alert("请输入开始时间");
	}
	else if(option.endtime.value=="")
	{
	alert("请输入结束时间");
	}
	else{
	option.submit();
	return true;
	}
	}



</SCRIPT>
</HEAD>
<BODY >

<%
 String begintime=new SimpleDateFormat("yyyyMMdd").format(new Date());
 String endtime=new SimpleDateFormat("yyyyMMdd").format(new Date());
 //begintime="20060715";
 //endtime="20060720";

 if((request.getParameter("begintime")!=null)){
    begintime=request.getParameter("begintime");
    begintime=begintime.substring(0,4)+begintime.substring(5,7)+begintime.substring(8,10);
    }
 if(request.getParameter("endtime")!=null){
    endtime=request.getParameter("endtime");
    endtime=endtime.substring(0,4)+endtime.substring(5,7)+endtime.substring(8,10);
    } 
  if((request.getParameter("areacode")!=null))
  {
  section=request.getParameter("areacode");
  //if(!section.equals("0")){
  //section=(String)session.getAttribute("mger_type");
  //}
  }
 // endtime=Integer.parseInt(endtime)+1+"01";
  //begintime=Integer.parseInt(begintime)+"01";

  
  
  %>


<FORM name=option action="data_tongji.jsp" method=post> 
   
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top align="center" colSpan=2>
							<TABLE cellSpacing=0 cellPadding=0 width="95%" bgColor=#f1f1f1 border=0>
								<TBODY>
									<TR height=40>
										<TD>
											<FONT color="#00ff80">
												<FONT color="#8000ff">
													 灵通邮使用情况表
												</FONT>
											</FONT>
										</TD>
										
										<TD align=right>
		 <%if(((String)session.getAttribute("mger_type")).equals("0")){%>
		 <select name="areacode" size=1>
         <option value="" selected><%out.print("--请选择各分公司--");%> </option>
            <option value="0"><%out.print("辽宁省公司");%> </option>
            <option value="024"><%out.print("沈阳分公司");%> </option>
            <option value="0411"><%out.print("大连分公司");%> </option>
            <option value="0412"><%out.print("鞍山分公司");%> </option>
            <option value="0413"><%out.print("抚顺分公司");%> </option>
            <option value="0414"><%out.print("本溪分公司");%> </option>
            <option value="0421"><%out.print("朝阳分公司");%> </option>
            <option value="0427"><%out.print("盘锦分公司");%> </option>
            <option value="0418"><%out.print("阜新分公司");%> </option>
            <option value="0416"><%out.print("锦州分公司");%> </option>
            <option value="0417"><%out.print("营口分公司");%> </option>
            <option value="0415"><%out.print("丹东分公司");%> </option>
            <option value="0419"><%out.print("辽阳分公司");%> </option>
            <option value="0429"><%out.print("葫芦岛公司");%></option>
            <option value="0410"><%out.print("铁岭分公司");%> </option>
            <!--option value="1111"><%out.print("客服管理");%></option-->
            </select>
            <%}%>
			开始时间
         <INPUT style="WIDTH: 70px" type="text" name=begintime value="">
         <input type="button" name="button_begin" value="&gt;&gt;" onClick="fPopUpCalendarDlg(begintime);return false">
          结束时间
          <INPUT  style="WIDTH: 70px" type="text"
            name=endtime value=""><input type="button" name="button_end" value="&gt;&gt;" onClick="fPopUpCalendarDlg(endtime);return false">
            <INPUT type=button name=tongji value="统计" onclick="return check()"></TD>
          
									</TR>
								</TBODY>
							</TABLE>
							<TABLE cellSpacing=0 cellPadding=0 width="95%" border=0>
								<TBODY>
									<TR>
										<TD>
											<TABLE id=dgDownLoad style="BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-COLOR: #cccccc; WIDTH: 100%; BORDER-TOP-COLOR: #cccccc; BORDER-COLLAPSE: collapse; BORDER-RIGHT-COLOR: #cccccc" borderColor=#cccccc cellSpacing=0 rules=all border=1>
												<TBODY>
													<TR style="BACKGROUND-COLOR: #d0ebee" align="center">
													    <TD style="WIDTH: 5%">
															<FONT color="#ff0080">&nbsp;日期</FONT>
														</TD>
														<TD style="WIDTH: 5%">
															<FONT color="#ff0080">&nbsp;地区名</FONT>
														</TD>
														<TD style="WIDTH: 5%">
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("使用网站");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=network&section=<%out.print(section);%>')">
															使用网站</a><%}%></FONT></TD>
														
														
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">&nbsp;
															<%if(begintime.equals(endtime))out.print("使用短信");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=smsup&section=<%out.print(section);%>')">
															使用短信</a><%}%></FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">
														<%if(begintime.equals(endtime))out.print("使用硬盘");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=str_ftp&section=<%out.print(section);%>')">															
															使用硬盘</a><%}%></FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">&nbsp;
															<%if(begintime.equals(endtime))out.print("网站注册");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=network_register&section=<%out.print(section);%>')">
															网站注册</a><%}%></FONT>
														</TD>
														
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080"> &nbsp;
															<%if(begintime.equals(endtime))out.print("短信注册");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=sms_register&section=<%out.print(section);%>')">
															短信注册</a><%}%> </FONT>
														</TD>
														<TD style="WIDTH:5%" align=left>
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("注销");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=logout&section=<%out.print(section);%>')">															
															注销</a><%}%></FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("暂停");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=pause&section=<%out.print(section);%>')">
															暂停</a><%}%></FONT>
														</TD>
														
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("收件数");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=str_from&section=<%out.print(section);%>')">															
															收件数</a><%}%></FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("发件数");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=str_to&section=<%out.print(section);%>')">														
															发件数</a><%}%></FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT color="#ff0080">
															<%if(begintime.equals(endtime))out.print("点击率");else{%>
<a href="#" onclick="javascrict:window.open('quxian_727002.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=visit_count&section=<%out.print(section);%>')">															
															点击率</a><%}%></FONT>
														</TD>
													</TR>
												<%
											if(request.getParameter("today")==null){
												   String sql="select * from data_collect where data_id in(select max(data_id) from data_collect where city='"+section+"' and date_time>='"+Integer.parseInt(begintime)+"01"+"' and date_time<='"+Integer.parseInt(endtime)+1+"01"+"' group by substring(date_time,1,8)) order by date_time desc";
												   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
													Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://61.138.179.131:1433;databasename=ymaildb","sa","mailadmin000"); 
													Statement stmt = con.createStatement();
													ResultSet rst = stmt.executeQuery(sql);
													while(rst.next()){
													%>
												
													<TR  align="center">
													<TD style="WIDTH: 5%" align=left>
																<FONT color="#8080ff">
																<%
												                  out.print(rst.getString("date_time").substring(0,4)+"."+rst.getString("date_time").substring(4,6)+"."+rst.getString("date_time").substring(6,8));
												                  %>
																</FONT>
														
													</TD>
													<TD style="WIDTH: 5%" align=left>
																<FONT color="#8080ff">
																<%

								              if(section.equals("024"))out.println("沈阳分公司");
								              else if(section.equals("0"))out.println("辽宁省公司");
											  else if(section.equals("0410"))out.println("铁岭分公司");
											  else if(section.equals("0411"))out.println("大连分公司");
											  else if(section.equals("0412"))out.println("鞍山分公司");
											  else if(section.equals("0413"))out.println("抚顺分公司");
											  else if(section.equals("0414"))out.println("本溪分公司");
											  else if(section.equals("0415"))out.println("丹东分公司");
											  else if(section.equals("0416"))out.println("锦州分公司");
											  else if(section.equals("0417"))out.println("营口分公司");
											  else if(section.equals("0418"))out.println("阜新分公司");
											  else if(section.equals("0419"))out.println("辽阳分公司");
											  else if(section.equals("0421"))out.println("朝阳分公司");
											  else if(section.equals("0427"))out.println("盘锦分公司");
											  else if(section.equals("0429"))out.println("葫芦岛公司");
																%>
																</FONT>
														
														</TD>
														<TD style="WIDTH: 5%" align=left>
																<FONT color="#8080ff">
																<%=rst.getInt("meshwork")%>
																</FONT>
														
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%= rst.getInt("combine")%>
																</FONT>
															</FONT>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("useftp")%>
																</FONT>
															</FONT>
														</TD>
													<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("meshwork_login")%>
																</FONT>
															</FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("combine_login")%>
																</FONT>
															</FONT>
														</TD>
														
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("logout")%>
																</FONT>
															</FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("pause")%>
																</FONT>
															</FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("from_mail")%>
																</FONT>
															</FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																	<%=rst.getInt("to_mail")%>
																</FONT>
															</FONT>
														</TD>
														<TD style="WIDTH: 5%" align=left>
															<FONT >
																
																<FONT color="#8080ff">
																		<%=rst.getInt("point_rate")%>
																</FONT>
															</FONT>
														</TD>
														
													</TR>
													<%}
												}
												
												%>
<SCRIPT language=javascript>

	function openwin() { 
//alert("dd");
　　window.open ("jfreepic.jsp?begintime=<%out.print(begintime);%>&endtime=<%out.print(endtime);%>&flag=network", "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") 
 
　　} 



</SCRIPT>
												</TBODY>
											</TABLE>
										</TD>
									</TR>
								</TBODY>
							</TABLE>
						</TD></TR>
  <TR>
    <TD height=20>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
        <TBODY>
        <TR>
          <!-- TD width=180><IMG height=40 
            src="Default.files/main_bottom_pic01.gif" width=180></TD-->
          <TD width="40%" background=Default.files/main_bottom_bg.gif></TD>
          <TD align=right background=Default.files/main_bottom_bg.gif>
            <TABLE style="FONT-SIZE: smaller; FONT-FAMILY: 宋体" cellSpacing=0 
            cellPadding=0 width="100%" align=center border=0>
              <TBODY>
              <TR>
                <!-- TD noWrap>共有<FONT style="COLOR: red"></FONT>条记录&nbsp;</TD-->
                <TD noWrap>当前为<FONT 
                  style="COLOR: red; FONT-FAMILY: 宋体"><%if(request.getParameter("today")==null)out.print("1");else out.print("0");%></FONT>/<FONT 
                  style="COLOR: red; FONT-FAMILY: 宋体"><%if(request.getParameter("today")==null)out.print("1");else out.print("0");%></FONT>页</TD>
                <TD noWrap align=right><INPUT style="BORDER-RIGHT: blue 1px; BORDER-TOP: blue 1px; FONT-SIZE: 12pt; BORDER-LEFT: blue 1px; CLIP: rect(auto auto auto auto); CURSOR: hand; COLOR: blue; BORDER-BOTTOM: blue 1px; FONT-FAMILY: Webdings; HEIGHT: 20px; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" disabled onclick="__doPostBack('pageHelper','first')" type=button value=9><INPUT style="BORDER-RIGHT: blue 1px; BORDER-TOP: blue 1px; FONT-SIZE: 12pt; BORDER-LEFT: blue 1px; CLIP: rect(auto auto auto auto); CURSOR: hand; COLOR: blue; BORDER-BOTTOM: blue 1px; FONT-FAMILY: Webdings; HEIGHT: 20px; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" disabled onclick="__doPostBack('pageHelper','prev')" type=button value=3><INPUT style="BORDER-RIGHT: blue 1px; BORDER-TOP: blue 1px; FONT-SIZE: 12pt; BORDER-LEFT: blue 1px; CLIP: rect(auto auto auto auto); CURSOR: hand; COLOR: blue; BORDER-BOTTOM: blue 1px; FONT-FAMILY: Webdings; HEIGHT: 20px; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" disabled onclick="__doPostBack('pageHelper','next')" type=button value=4><INPUT style="BORDER-RIGHT: blue 1px; BORDER-TOP: blue 1px; FONT-SIZE: 12pt; BORDER-LEFT: blue 1px; CLIP: rect(auto auto auto auto); CURSOR: hand; COLOR: blue; BORDER-BOTTOM: blue 1px; FONT-FAMILY: Webdings; HEIGHT: 20px; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" disabled onclick="__doPostBack('pageHelper','last')" type=button value=:>
               </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
